<%
var title= isEmpty(userAccount.id)?"新增":"编辑";
layout("/common/layout.html",{"title":title+"办件事项"}){
%>
<div class="row wrapper border-bottom white-bg page-heading">
    <div class="col-sm-8">
        <h2>${title}办件事项</h2>
        <ol class="breadcrumb">
            <li><a href="${ctxPath}/admin/main">主页</a></li>
            <li><a href="${ctxPath}/itemInfo/view/index">办件事项管理</a></li>
            <li class="active">${title}</li>
        </ol>
    </div>
    <div class="col-sm-4">
        <div class="title-action">
            <a class="btn btn-primary btn-sm btn-outline" href="${ctxPath}/itemInfo/view/index">
                <i class="fa fa-reply"> </i> 返回列表</a>
        </div>
    </div>
</div>
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins animated fadeInDown">
        <div class="ibox-content" id="step-box">

            <div class="panel panel-default">
                <div class="panel-heading">
                    <b class="text step-title">办件事项</b>
                </div>
                <div class="panel-body">
                    <form class="form-horizontal" name="itemForm" id="itemForm" role="form">
                        <input value="${item.id!}" name="id" type="hidden">
                        <div class="form-group">
                            <label class="col-sm-1 control-label">事项名称：</label>
                            <div class="col-sm-3">
                                <input name="title" class="form-control" type="text" maxlength='30' value="${item.title!}" placeholder="请输入事项名称" aria-required="true" required="required">
                            </div>

                            <label class="col-sm-1 control-label">事项标示：</label>
                            <div class="col-sm-3">
                                <select name="itemType" id="itemType" class="form-control">
                                    <option value="">暂无标示</option>
                                    <%
                                    if(isNotEmpty(itemTypeList)){
                                    for(itemType in itemTypeList){
                                    %>
                                    <option value="${itemType.key!}" ${itemType.key==item.itemType?"selected"}>${itemType.value}</option>
                                    <% }
                                    }
                                    %>
                                </select>
                            </div>

                            <label class="col-sm-1 control-label">事项性质：</label>
                            <div class="col-sm-3">
                                <select name="matterNature" id="matterNature" class="form-control">
                                    <%
                                    if(isNotEmpty(matterNatureList)){
                                    for(matterNature in matterNatureList){
                                    %>
                                    <option value="${matterNature.key!}"  ${matterNature.key==item.matterNature?"selected"} >${matterNature.value}</option>
                                    <% }
                                    }
                                    %>
                                </select>
                            </div>


                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">事项分类：</label>
                            <div class="col-sm-1">
                                <select class="form-control cateId" id="cateId" name="cateId"></select>
                            </div>
                            <div class="col-sm-2">

                                <select class="form-control mainId" id="mainId" name="mainId"></select>
                            </div>
                            <label class="col-sm-1 control-label">法定时限：</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input name="legalTerm" class="form-control" type="number" value="${item.legalTerm!}" placeholder="请输入法定时限" aria-required="true" required="required">
                                    <span class="input-group-addon">工作日</span>
                                </div>
                            </div>
                            <label class="col-sm-1 control-label">承诺时限：</label>
                            <div class="col-sm-3">
                                <div class="input-group">
                                    <input name="promiseTerm" class="form-control" type="number" value="${item.promiseTerm}" placeholder="请输入承诺时限" aria-required="true" required="required">
                                    <span class="input-group-addon">工作日</span>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">办公地址：</label>
                            <div class="col-sm-3">
                                <input name="address" class="form-control" type="text"
                                       value="${item.address!}" placeholder="请输入办公地址"
                                       aria-required="true" required="required">
                            </div>
                            <label class="col-sm-1 control-label">联系电话：</label>
                            <div class="col-sm-3">
                                <input name="phone" class="form-control" type="text" value="${item.phone!}"
                                       placeholder="请输入联系电话" aria-required="true" required="required">
                            </div>
                            <label class="col-sm-1 control-label">工作时间：</label>
                            <div class="col-sm-3">
                                <input id="officeTime" name="officeTime" class="form-control" type="text" value="${item.officeTime!}"  placeholder="请输入办公时间" aria-required="true" required="required" >
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-1 control-label">事项链接：</label>
                            <div class="col-sm-3">
                                <input name="link" class="form-control" type="text" value="${item.link!}" placeholder="请输入事项链接" aria-required="true" required="required">
                            </div>
                            <label class="col-sm-1 control-label">事项排序：</label>
                            <div class="col-sm-3">
                                <input name="sort" class="form-control" type="number" value="${item.sort}" placeholder="请输入事项顺序" aria-required="true" required="required">
                            </div>
                            <label class="col-sm-1 control-label">审批主体：</label>
                            <div class="col-sm-3">
                                <input name="approvalUnit" class="form-control" type="text" value="${item.approvalUnit!}" placeholder="请输入审批主体" aria-required="true" required="required">
                            </div>
                        </div>
<div id="layer"
									style="display: none; position: absolute; z-index: 1;"></div>
						<div class="form-group">
							<label class="col-sm-1 control-label">app图标：</label>
							
							<div class="col-sm-3"  id="picture">
									<input type="file" class="form-control" id="pictureUploader"
										name="files" data-max-file-count="1" multiple="multiple">
								 <input id="pictureVal"  type="hidden"  name="picture"  value="${item.picture!'/images/nopic.jpg'}">
							</div>
						</div>


						<div class="form-group">
                            <label for="guide" class="col-sm-1 control-label">办事指南：</label>
                            <div class="col-sm-11">
                                <textarea id="guide" name="guide" hidden="hidden">${item.guide!}</textarea>
                                <div id="guideEditer">
                                    <p>${item.guide!}</p>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="cost" class="col-sm-1 control-label">收费信息：</label>
                            <div class="col-sm-11">
                                <textarea id="cost" name="cost" hidden="hidden">${item.cost!}</textarea>
                                <div id="costEditer">
                                    <p>${item.cost!}</p>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="material" class="col-sm-1 control-label">申请材料：</label>
                            <div class="col-sm-11">
                                <textarea id="material" name="material" hidden="hidden">${item.material!}</textarea>
                                <div id="materialEditer">
                                    <p>${item.material!}</p>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>

                <div class="panel-footer">
                    <div class="col-sm-offset-3 clearfix">
                        <div class="mt5 mb5 block col-sm-3">
                            <a href="index" class="btn btn-white btn-block"><i class="fa fa-times"></i>&ensp;取消</a>
                        </div>
                        <div class="mt5 mb5 block col-sm-3">
                            <button id="doSubmit" class="btn btn-primary btn-block"><i class="fa fa-check"></i>&ensp;保存</button>
                        </div>
                    </div>
                </div>

            </div>

        </div>

    </div>

</div>
<% } %>
<script type="text/javascript">
    //页面JS调用
    require(['item/item'], function (item) {
        item.save("${item.cateId!}","${item.mainId!}");
    });
   
</script>